package com.hxzy.controller;

import com.hxzy.common.web.resp.R;
import com.hxzy.module.admin.resp.AccountDetailResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@Api(tags = "总部后台-账户相关的Api")
@RequestMapping(value = "/admin-ribbon")
@RestController
public class RibbonAdminController {

    @Autowired
    private RestTemplate restTemplate;


    @ApiOperation(value = "根据id查询")
    @GetMapping(value = "/account/{id}")
    public R<AccountDetailResp> adminAccountFindById(@PathVariable(value = "id") String accountId){
        //通过用程调用http://服务名/url地址
        String url="http://admin/admin/account/"+accountId;
        R r = restTemplate.getForObject(url, R.class);
        AccountDetailResp accountDetailResp = AdminController.getAccountDetailResp(r);
        //获取当前account门户店信息

        return R.okHasData(accountDetailResp);
    }



}
